<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="javax.servlet.http.Cookie" %>
    
<%
//检查登录
Cookie[] cookies = request.getCookies();
String logonusername = null;
if (cookies != null) {
    for (Cookie cookie : cookies) {
        if ("logonusername".equals(cookie.getName())) {
        	logonusername = cookie.getValue(); // 获取Cookie的值
            break; 
        }
    }
}
if(logonusername!=null){
	out.println("<script>alert('"+logonusername+"，您已登录无需注册！');window.location.href='index.jsp'</script>");
}
%>

<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" href="style/css/login.css" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Login</title>
</head>
<style>
li{
	list-style: none;
}
</style>
<body>
<div id="app">
	<div class="top ce b00f">
		<h1 class="title">login / 注册</h1>
	</div>
	<div class="main ce">
		<form action="api/mess_login.jsp" method="post">
			<li><input type="text" name="username" placeholder="用户名"></li>
			<li><input type="password" name="password" placeholder="密码"></li>
			<li><input type="password" name="verpassword" placeholder="确认密码"></li>
			<li><input type="submit" name="login" value="Login"/></li>
		</form>
		<a href="logon.jsp">有账号，登录</a>
	</div>
</div>
</body>
</html>